package com.qingzhou.framework.config;

import com.github.xiaoymin.knife4j.solon.extension.OpenApiExtensionResolver;
import org.noear.solon.annotation.Bean;
import org.noear.solon.annotation.Configuration;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.handle.Result;
import org.noear.solon.docs.DocDocket;
import org.noear.solon.docs.models.ApiContact;
import org.noear.solon.docs.models.ApiInfo;
import org.noear.solon.docs.models.ApiScheme;

/**
 * 接口文档配置
 *
 * @author xm
 */
@Configuration
public class DocConfig {

    @Inject
    OpenApiExtensionResolver openApiExtensionResolver;

    /** 接口文档摘要 */
    @Bean("appApi")
    public DocDocket appApi() {
        return new DocDocket()
            .basicAuth(openApiExtensionResolver.getSetting().getBasic())
            .vendorExtensions(openApiExtensionResolver.buildExtensions())
            .groupName("系统接口")
            .info(new ApiInfo().title("接口文档")
                .description("在线API文档")
//                        .termsOfService("https://gitee.com/noear/solon")
                .contact(new ApiContact().name("xm"))
                .version("1.0"))
            .schemes(ApiScheme.HTTP.toValue(), ApiScheme.HTTPS.toValue())
            .globalResponseInData(true)
            .globalResult(Result.class)
            .apis("com.qingzhou.web.controller");
    }

}
